﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Roles.aspx.cs" Inherits="Skyworth.CRM.Web.SystemManagement.Roles" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>系统角色管理</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <%--[if IE]>
     <link href="../themes/css/ieHack.css" rel="stylesheet" type="text/css" />
    <![endif]--%>
    <link href="../themes/<%= Request.Cookies["dwz_theme"]!=null? Request.Cookies["dwz_theme"].Value:"default" %>/style.css"
        rel="stylesheet" type="text/css" />
    <link href="../themes/css/core.css" rel="stylesheet" type="text/css" />
    <link href="../themes/css/pages.css" rel="stylesheet" type="text/css" />
    <link href="../themes/css/wbox.css" rel="stylesheet" type="text/css" />
    <link href="../themes/css/Messagebox.css" rel="stylesheet" type="text/css" />

    <script src="../javascripts/jquery-1.4.4.min.js" type="text/javascript"></script>

    <script src="../javascripts/MessageBox.js" type="text/javascript"></script>

    <script src="../javascripts/jquery.tablesorter.min.js" type="text/javascript"></script>

    <script src="../javascripts/dwz.pagination.js" type="text/javascript"></script>

    <script src="../javascripts/wbox.js" type="text/javascript"></script>

    <script type="text/javascript">
        var addWindow;
        $(document).ready(function() {

            $(".tableList table.list").tablesorter({ headers: { 0: { sorter: false}} });
            $("ul.toolBar li").hover(function() { $(this).addClass("hover"); },
                                                function() { $(this).removeClass("hover"); }
                     );
            //绑定表格行事件         
            $(".tableList table.list tbody tr:nth-child(even)").attr('class', "trbg");
            $(".tableList table.list tbody tr").hover(function() { $(this).addClass("hover"); },
                                                function() { $(this).removeClass("hover"); }).click(function() {
                                                    $(this).addClass("selected")
                                                    $(this).siblings().removeClass("selected");
                                                    $("#selectedRoleID").val($(this).attr("rel"));
                                                })

            //绑定表格中授权按钮事件
            $(".tableList table.list tbody tr a.openWindow").click(function() {
                var roleId = $(this).attr("id");
                var url = "SystemManagement/RoleCommision.aspx?RoleId=" + roleId;
                var pageTitle = "对【" + $(this).parent("td").parent("tr").children("td").eq(1).text() + "】授权";
                parent.navTab.openTab(roleId, url, { title: pageTitle, isIframe: true });

                return false; //阻止事件冒泡
            })
            $("#btnAdd").click(function() {
                if ($(this).attr("disabled") != "disabled") {
                    //绑定更新和删除按钮事件
                    addWindow = $("#selectedRoleID").wBox({ title: "新增角色", requestType: "iframe", target: "EditRole.aspx?Type=add", iframeWH: { width: 400, height: 205} });
                    addWindow.showBox();                  
                }
                return false;
            })
            $("#btnUpdate").click(function() {
                if ($(this).attr("disabled") != "disabled") {
                    var roleId = $("#selectedRoleID").val();
                    if (parseInt(roleId) > 0) {
                        addWindow = $("#selectedRoleID").wBox({ title: "修改角色信息", requestType: "iframe", target: "EditRole.aspx?Type=update&RoleId=" + roleId, iframeWH: { width: 400, height: 205} });
                        addWindow.showBox();
                    }
                    else {
                        $.Messager.Alert({ Title: '系统消息', Message: "请选择要修改的角色！", Icon: IconType.Warning });
                    }
                    return false;
                }
            })

            $("#btnDelete").click(function() {
                if ($(this).attr("disabled") != "disabled") {
                    var roleId = $("#selectedRoleID").val();
                    if (parseInt(roleId) > 0) {
                        $.Messager.Confirm({ Title: '系统警告', Message: '你确定要删除该角色信息吗?', Icon: IconType.Question,
                            Oncallback: function(IsYes, siteMapId) {
                                if (IsYes) { $("#btnhidDelete").trigger("click"); }
                            }
                        })
                    }
                    else {
                        $.Messager.Alert({ Title: '系统消息', Message: "请选择要删除的角色！", Icon: IconType.Warning });
                    }
                    return false;
                }
            })

            $("div.button").hover(function() { $(this).addClass("buttonHover"); },
                                 function() { $(this).removeClass("buttonHover"); });
            $("div.buttonActive").hover(function() { $(this).addClass("buttonActiveHover"); },
                                function() { $(this).removeClass("buttonActiveHover"); })



        });
    </script>

</head>
<body style="overflow: visible;">
    <div>
        <form id="form1" runat="server">
        <table width="100%">
            <tr>
                <td>
                    <div class="searchBar" style="padding: 4px 5px;">
                        <ul>
                            <li style="float: left;"><span>名称：</span>
                                <asp:TextBox ID="txtRoleName" runat="server"></asp:TextBox>
                            </li>
                            <li style="float: left; padding-left: 20px">
                                <div class="buttonActive">
                                    <div class="buttonContent">
                                        <asp:Button ID="btnSearch" runat="server" Text="查询" ToolTip="查询员工信息" CssClass="serverButton"
                                            CommandArgument="5" OnClick="btnSearch_Click" />
                                    </div>
                                </div>
                            </li>
                            <li style="clear: both"></li>
                        </ul>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="panelBar">
                        <ul class="toolBar">
                            <li class="">
                                <asp:LinkButton ID="btnAdd" CommandArgument="2" runat="server" CssClass="add"><span>添加角色信息</span> </asp:LinkButton></li>
                            <li class="line">line</li>
                            <li class="">
                                <asp:LinkButton ID="btnUpdate" CommandArgument="3" runat="server" CssClass="edit"><span>修改角色信息</span> </asp:LinkButton></li>
                            <li class="line">line</li>
                            <li class="">
                                <asp:LinkButton ID="btnDelete" CommandArgument="4" runat="server" CssClass="delete"><span>删除角色信息</span> </asp:LinkButton></li>
                            <li class="line">line</li>
                            <li>
                                <asp:Button ID="btnhidDelete" runat="server" Text="" Style="display: none;" OnClick="btnhidDelete_Click" />
                                <input type="hidden" style="display: none;" id="selectedRoleID" runat="server" />
                            </li>
                        </ul>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="pageContent" style="_margin-top: -2px;">
                        <div class="tableList">
                            <table class="list" width="100%">
                                <thead>
                                    <tr>
                                        <th width="100" valign="middle">
                                            对角色授权
                                        </th>
                                        <th width="250" style="cursor: pointer;" class="headerSortUp">
                                            <span style="float: left">角色名称</span> <span style="float: right;" class="sortIcon">
                                            </span>
                                        </th>
                                        <th style="cursor: pointer;">
                                            <span style="float: left">角色说明</span> <span style="float: right;" class="sortIcon">
                                            </span>
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <asp:Literal ID="RoleTableBody" runat="server"></asp:Literal>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </td>
            </tr>
        </table>
        </form>
    </div>
</body>
</html>
